package com.i2863.receipt.util;

import com.alibaba.fastjson.JSONObject;

/**
 * Created by Administrator on 2018/6/13.
 */
public class ApiResultJson {
    //0 ： 成功，1 ： 失败
    private Integer code;
    //返回的信息
    private String message;
    //需要返回的内容
    private Object data;

    /**
     * 成功，自定义code返回
     * @param code
     * @param message
     * @param content
     * @return
     */
    public static String successResult(Integer code,String message,Object content){
        ApiResultJson result = new ApiResultJson();
        result.code = code;
        result.message = message;
        result.data = content;
        return JSONObject.toJSONString(result);
    }


    /**
     *返回成功消息（自定义状态码）
     * @return
     */
    public static String successMeg(Integer code,String message){
        ApiResultJson result = new ApiResultJson();
        result.code = code;
        result.message = message;
        return JSONObject.toJSONString(result);
    }


    /**
     * 返回错误消息(自定义状态码)
     * @param message
     * @return
     */
    public static String errorMes(Integer code,String message){
        ApiResultJson result = new ApiResultJson();
        result.code = code;
        result.message = message;
        return JSONObject.toJSONString(result);
    }

    /**
     * 成功
     */
    public static Integer SUCCESS = 200;

    /**
     * 未查询到结果
     */
    public static Integer NO_DATA = 202;

    /**
     * 服务器未知错误
     */
    public static Integer UNKNOW_ERROR = 0;

    /**
     * 请求参数异常
     */
    public static Integer DATA_ABNORMAL = 300;

    /**
     * 活动已结束
     */
    public static Integer ACTIVITY_END = 401;

    /**
     * 发票已存在
     */
    public static Integer RECEIPT_EXISTS = 402;

    /**
     * 活动不存在
     */
    public static Integer ACTIVITY_UNDEFINE = 403;

    public static Integer RECEIPTDATE_INCONFORMITY = 404;

    /**
     * 发票金额不足
     * @return
     */
    public static Integer RECEIPTMONEY_INSUFFICIENT = 405;

    /**
     * 商户名称为空
     */
    public static Integer BUSINESSNAME_NULL = 406;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
